using System;

namespace PaulRz.Util.Patterns
{
	public enum Severity
	{
		/// <summary>
		/// All log messages.
		/// </summary>
		Debug					= 0, 

		/// <summary>
		/// Accessing device.
		/// </summary>
		AccessingDevice			= 1, 

		/// <summary>
		/// Receiving and sending message.
		/// </summary>
		ProcessingContent		= 2, 

		/// <summary>
		/// Reconfiguring, can receive, connected.
		/// </summary>
		OperationalStateChange	= 3, 

		/// <summary>
		/// Initalizing, deinitializing and shuting down log messages.
		/// </summary>
		SystemStateChange		= 4,
		
        /// <summary>
		/// Message processing errors.
		/// </summary>
        ProcessingError = 5 
	}
	
    /// <summary>
    /// Logger interface
    /// </summary>
    public interface ILogInterface
    {
        /// <summary>
        /// Increments the value of specified performance counter
        /// </summary>
        /// <param name="counter"></param>
        void IncrementCounter(LogCounters counter);
        /// <summary>
        /// Logs an error to error and activity logs
        /// </summary>
        /// <param name="logMessage"></param>
        void LogError(String logMessage);

        /// <summary>
        /// Logs an error to logs using formatting
        /// </summary>
        /// <param name="format"></param>
        /// <param name="args"></param>
        void LogError(string format, params object[] args);
        /// <summary>
        /// Logs an event into activity log
        /// </summary>
        /// <param name="logMessage"></param>
        void LogEvent(String logMessage);
        /// <summary>
        /// Logs an event into activity log using formatting
        /// </summary>
        /// <param name="format"></param>
        /// <param name="args"></param>
        void LogEvent(string format, params object[] args);
        /// <summary>
        /// Logs an event into activity log using formatting with severity specified
        /// </summary>
        /// <param name="logSeverity"></param>
        /// <param name="format"></param>
        /// <param name="args"></param>
        void LogEvent(Severity logSeverity, string format, params object[] args);
        /// <summary>
        /// Logs an event into activity log with severity specified
        /// </summary>
        /// <param name="logSeverity"></param>
        /// <param name="logMessage"></param>
        void LogEvent(Severity logSeverity, string logMessage);
        /// <summary>
        /// Logs a communication data exchange into data log with formatting
        /// </summary>
        /// <param name="format"></param>
        /// <param name="args"></param>
        void LogCommunication(string format, params object[] args);
        /// <summary>
        /// Logs a communication data exchange into data log
        /// </summary>
        /// <param name="logMessage"></param>
        void LogCommunication(string logMessage);
    }
    
    /// <summary>
    /// Default logger for ActiveObject
    /// </summary>
    internal sealed class  FakeLogger : ILogInterface
    {
        public static FakeLogger Default = new FakeLogger();

        public void IncrementCounter(LogCounters counter)
        {
        }

        public void LogError(string logMessage)
        {
        }

        public void LogError(string format, params object[] args)
        {
        }

        public void LogEvent(string logMessage)
        {
        }

        public void LogEvent(string format, params object[] args)
        {
        }

        public void LogEvent(Severity logSeverity, string format, params object[] args)
        {
        }

        public void LogEvent(Severity logSeverity, string logMessage)
        {
        }

        public void LogCommunication(string format, params object[] args)
        {
        }

        public void LogCommunication(string logMessage)
        {
        }
    }
}
